package com.aaa.controller.sds;

import com.aaa.entity.LayData;
import com.aaa.entity.MyPage;
import com.aaa.entity.scl.SclPlane;
import com.aaa.entity.sds.TSdsPlane;
import com.aaa.entity.sds.TSdsRecord;
import com.aaa.service.sds.TSdsPlaneService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * (TSdsPlane)表控制层
 *
 * @author makejava
 * @since 2022-10-27 16:55:08
 */
@RestController
@RequestMapping("/tSdsPlane")
public class TSdsPlaneController {
    /**
     * 服务对象
     */
    @Autowired
    private TSdsPlaneService tSdsPlaneService;

//    //查询所有
//    @RequestMapping("/queryAllPlane")
//    @ResponseBody
//    public LayData queryAllPlane(MyPage myPage,TSdsPlane tSdsPlane){
//        PageInfo pageInfo=tSdsPlaneService.queryAllPlane(myPage,tSdsPlane);
//        System.out.println("pageInfo = " + pageInfo);
//        return new LayData(pageInfo);
//    }

    //添加
    @RequestMapping("/insertPlane")
    @ResponseBody
    public LayData insertSds(TSdsPlane tSdsPlane , HttpSession session){
        boolean insertplan = tSdsPlaneService.insertplan(tSdsPlane,session);
        System.out.println("insertplan = " + insertplan);
        return new LayData(insertplan);
    }

    /**
     * 修改
     * @param tSdsPlane
     * @return
     */
    @RequestMapping("/updPlan")
    @ResponseBody
    public LayData updPlan(TSdsPlane tSdsPlane){
        boolean update = tSdsPlaneService.updatePlan(tSdsPlane);
        System.out.println("update = " + update);
        return new LayData(update);
    }

    /**
     * 通过planename查询
     * @param
     * @return
     */
   // @RequestMapping("/queryName")
/*
    @ResponseBody
    public LayData queryName(String planename){
        TSdsPlane tSdsPlane = tSdsPlaneService.queryName(planename);
        System.out.println("tSdsPlane = " + tSdsPlane);
        return new LayData(tSdsPlane);
    }
*/

    /**
     * 查询邀请码
     * @param tSdsPlane
     * @return
     */
    @GetMapping("getByCode")
    public LayData queryByQyCode(TSdsPlane tSdsPlane){
        return new LayData(tSdsPlaneService.queryByQyCode(tSdsPlane));
    }

    /**
     * 模糊查询
     * @param myPage
     * @param tSdsPlane
     * @return
     */
    @GetMapping("querysdsPaneAll")
    @ResponseBody
    public LayData querysdsAll(MyPage myPage, TSdsPlane tSdsPlane){
        PageInfo pageInfo = tSdsPlaneService.querysdsAll(myPage,tSdsPlane);
        return new LayData(pageInfo);
    }

}


